<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <title>Tag CODE</title>
 </head>  
 <body> 
  <p>Tag CODE</p>
  <p></p>
  <p>Program code</p>
  <p><code>
    function checkParent (src, dest) {<Br>
     while (src != null) {</Br>
       if (src.tagName == dest) return src<Br>
        src = src.parentElement</Br>
     }<Br>
     return null</Br>
    }</code></p>

 </body>
</html>